var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("GlobalParams"),
    i = e("AssetsManager"),
    r = e("AudioManager"),
    s = e("Game"),
    l = e("RoleSoldierInfo"),
    c = e("UIManager"),
    d = e("ShopViewUI"),
    h = cc._decorator,
    _ = h.ccclass,
    u = h.property,
    p = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.dower_icon = null),
                (t.name_label = null),
                (t.dower_level = null),
                (t.dower_info_label = null),
                (t.dower_now_num = null),
                (t.next_up_node = null),
                (t.next_level_label = null),
                (t.next_up_num = null),
                (t.max_level_node = null),
                (t.up_level_btn = null),
                (t.buy_dower_btn = null),
                (t.dower_num_bar = null),
                (t.dower_have_num = null),
                (t.red_dot_node = null),
                (t.dower_index = 0),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.showDowerInfo = function (e) {
                this.dower_index = e;
                var t = l.default.Dower_info[this.dower_index],
                    o = a.GlobalParams.PlayerDowerInfo.value,
                    n = o.dower[this.dower_index];
                (this.dower_icon.spriteFrame = i.default
                    .getInstance()
                    .getDowerImagerFrame("dower_" + this.dower_index)),
                    (this.name_label.string = "[" + t.spirit_name + "]"),
                    (this.dower_level.string = "LV." + n),
                    (this.dower_info_label.string = "" + t.spirit_des),
                    (this.dower_now_num.string = "" + t.spirit_int[n]),
                    (this.next_up_node.active = n < 6),
                    this.next_up_node.active &&
                        ((this.next_level_label.string = "[" + (n + 1) + "级武魂]"),
                        (this.next_up_num.string = "" + t.spirit_int[n + 1])),
                    (this.max_level_node.active = !this.next_up_node.active);
                var r = o.debris[this.dower_index],
                    c = n < 5 ? s.default.dower_up_level[n] : 999999999;
                if (n < 5) {
                    this.up_level_btn.active = r >= c;
                    var d = (200 * r) / c;
                    (d = d > 200 ? 200 : d), (this.dower_num_bar.width = d), (this.dower_have_num.string = r + "/" + c);
                } else (this.up_level_btn.active = !1), (this.dower_have_num.string = "max");
                (this.buy_dower_btn.active = !this.up_level_btn.active),
                    (this.red_dot_node.active = this.up_level_btn.active),
                    this.buy_dower_btn.on("click", this.goShopDower, this),
                    this.up_level_btn.on("click", this.upDowerlevel, this);
            }),
            (t.prototype.goShopDower = function () {
                r.default.ButtonSound(),
                    cc
                        .find("UIManager")
                        .getComponent(c.default)
                        .showPopup("ShopViewUI", function (e) {
                            e.getComponent(d.default).showShopTypeInfo("shop_talent_btn");
                        }),
                    cc.find("Canvas/DowerViewUI").destroy();
            }),
            (t.prototype.upDowerlevel = function () {
                r.default.ButtonSound();
                var e = a.GlobalParams.PlayerDowerInfo.value,
                    t = s.default.dower_up_level[e.dower[this.dower_index]];
                e.dower[this.dower_index]++,
                    (e.debris[this.dower_index] -= t),
                    (a.GlobalParams.PlayerDowerInfo.value = e),
                    this.showDowerInfo(this.dower_index),
                    cc.find("UIManager").getComponent(c.default).playerTaskOverInfo(7, 1);
            }),
            __decorate([u(cc.Sprite)], t.prototype, "dower_icon", void 0),
            __decorate([u(cc.Label)], t.prototype, "name_label", void 0),
            __decorate([u(cc.Label)], t.prototype, "dower_level", void 0),
            __decorate([u(cc.Label)], t.prototype, "dower_info_label", void 0),
            __decorate([u(cc.Label)], t.prototype, "dower_now_num", void 0),
            __decorate([u(cc.Node)], t.prototype, "next_up_node", void 0),
            __decorate([u(cc.Label)], t.prototype, "next_level_label", void 0),
            __decorate([u(cc.Label)], t.prototype, "next_up_num", void 0),
            __decorate([u(cc.Node)], t.prototype, "max_level_node", void 0),
            __decorate([u(cc.Node)], t.prototype, "up_level_btn", void 0),
            __decorate([u(cc.Node)], t.prototype, "buy_dower_btn", void 0),
            __decorate([u(cc.Node)], t.prototype, "dower_num_bar", void 0),
            __decorate([u(cc.Label)], t.prototype, "dower_have_num", void 0),
            __decorate([u(cc.Node)], t.prototype, "red_dot_node", void 0),
            __decorate([_], t)
        );
    })(n.default);
o.default = p;
